package com.kyzh.core.adapters

import android.graphics.Color
import android.graphics.Paint
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
import com.gushenge.core.beans.Deal
import com.gushenge.core.beans.Deal1
import com.kyzh.core.R
import com.kyzh.core.databinding.ItemGameDetailDealBinding
import com.kyzh.core.utils.setVisibility

class GameDetailDea1lAdapter(val beans: ArrayList<Deal1>, var type:Int = 0) : BaseQuickAdapter<Deal1, BaseDataBindingHolder<ItemGameDetailDealBinding>>(R.layout.item_game_detail_deal, beans),LoadMoreModule {
    override fun convert(holder: BaseDataBindingHolder<ItemGameDetailDealBinding>, item: Deal1) {
        holder.dataBinding?.apply {
            //#荣耀大天使（送GM工具箱）#、#安卓#
            var shuoming = "#${item.gname} "
            if(item.system_type.isNotEmpty()){
                shuoming += "、#${item.system_type}#"
            }
            if(item.yuanjia.isNullOrBlank()){
                group.setVisibility(false)
                tvMoney3.setVisibility(false)
                if(type == 2){
                    group.setVisibility(true)
                }
            }else{
                when (type) {
                    1 -> {
                        group.setVisibility(false)
                        tvMoney3.setVisibility(true)
                        tvMoney3.paint.flags =  Paint.STRIKE_THRU_TEXT_FLAG
                    }
                    2 -> {
                        tvMoney3.paint.flags =  Paint.STRIKE_THRU_TEXT_FLAG
                        group.setVisibility(true)
                    }
                    else -> {
                        group.setVisibility(false)
                        tvMoney3.setVisibility(false)
                    }
                }
            }
            item.shuoming =shuoming
            data = item
        }
    }
}